//
//  ShowViewController.m
//  UI_通讯录.通讯录.
//
//  Created by 男哥呵呵 on 16/1/21.
//  Copyright © 2016年 Mr.x. All rights reserved.
//

#import "ShowViewController.h"

@interface ShowViewController ()

@property (nonatomic, strong) UIImageView *imageView;
@property (nonatomic, strong) UILabel *nameWithGender;
@property (nonatomic, strong) NSString *gender;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) UILabel *phoneNum;
@property (nonatomic, strong) UILabel *adress;

@end

@implementation ShowViewController

- (instancetype)init {
    self = [super init];
    if (self) {
        _showModel = [AdressBookModel alloc];
    }
    return self;
}

- (void)viewWillAppear:(BOOL)animated {
    self.imageView.image = _showModel.image;
    self.phoneNum.text = _showModel.phoneNum;
    self.adress.text = _showModel.adress;
}



- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    self.name = _showModel.name;
    self.gender = _showModel.gender;
    
    UIImageView *view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 20, self.view.frame.size.width, self.view.frame.size.height / 3 + 75)];
    view.image = [UIImage imageNamed:@"3"];
    [self.view addSubview:view];
    
    self.phoneNum = [[UILabel alloc] initWithFrame:CGRectMake(0, view.frame.size.height - 20, view.frame.size.width, 20)];
    self.phoneNum.textAlignment = NSTextAlignmentCenter;
    [view addSubview:self.phoneNum];
    
    
    self.nameWithGender = [[UILabel alloc] initWithFrame:CGRectMake(0, view.frame.size.height - 40, view.frame.size.width, 20)];
    self.nameWithGender.textAlignment = NSTextAlignmentCenter;
    self.nameWithGender.text = [NSString stringWithFormat:@"姓名:%@, 性别:%@", self.name, self.gender];
    [view addSubview:self.nameWithGender];
    
    self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
    self.imageView.center = view.center;
    [view addSubview:self.imageView];
    
    self.adress = [[UILabel alloc] initWithFrame:CGRectMake(0, view.frame.size.height + 30, self.view.frame.size.width, 30)];
    self.adress.textAlignment = NSTextAlignmentCenter;
    self.adress.font = [UIFont systemFontOfSize:20];
    [self.view addSubview:self.adress];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
